def parse_data(file):
    with open(file) as f:
        return [int(line.strip().split()[-2]) for line in f]


def mean(data):
    return sum(data) / len(data)


def calc_diff(after, before):
    mean_after = mean(after)
    mean_before = mean(before)
    difference = mean_before - mean_after
    return mean_after, mean_before, difference, difference / mean_before


before = parse_data("data/skiplist_timer.log")
after = parse_data("data/skiplist_random.log")
print("before", before)
print("after", after)
print(calc_diff(after, before))
